
    var bannerOne=$(".banner ul li:first-child");
    var bannerList=$(".banner ul");
    var bannerDot=$(".banner ol li");
    var index = 0;
    var timer;
    carouselAuto();
    bannerOne.clone().appendTo(".banner ul:first-child");
    $(document).find(".banner").swipeLeft(function(){
        if (index == $(".banner ul li").length-1) {
            index = 0;
            bannerList.css("left", 0);
        }
        index++;
        bannerList.animate({left: -index * $(".banner ul li").width()}, 1000);
        if(index == $(".banner ul li").length-1){
            bannerDot.eq(0).addClass("on").siblings().removeClass("on");
        }else{
            bannerDot.eq(index).addClass("on").siblings().removeClass("on");
        }
        carouselStop();
        carouselAuto();
    });
    $(document).find(".banner").swipeRight(function(){
        if (index == 0) {
            index = $(".banner ul li").length -1 ;
            console.log(index);
            bannerList.css("left", -index * $(".banner ul li").width() );
        }
        index--;
        bannerList.animate({left: -index * $(".banner ul li").width()}, 1000);
        if(index == $(".banner ul li").length-1){
            bannerDot.eq(0).addClass("on").siblings().removeClass("on");
        }else{
            bannerDot.eq(index).addClass("on").siblings().removeClass("on");
        }
        carouselStop();
        carouselAuto();
    });
    function carouselAuto(){
        timer = setInterval("carousel()", 4000);
    }
    function carouselStop(){
        clearInterval(timer);
    }
    function carousel() {
    if (index == $(".banner ul li").length-1) {
        index = 0;
        bannerList.css("left", 0);
    }
    index++;
    bannerList.animate({left: -index * $(".banner ul li").width()}, 1000);
    if(index == $(".banner ul li").length-1){
        bannerDot.eq(0).addClass("on").siblings().removeClass("on");
    }else{
        bannerDot.eq(index).addClass("on").siblings().removeClass("on");
    }
}